package cn.com.gridinfo.sooc.core.my.setting.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.com.gridinfo.sooc.R;
import cn.com.gridinfo.sooc.core.my.setting.bean.GetQuestion;

/**
 * 显示问题列表适配器
 * Created by 刘晓晨 on 2015/12/24.
 */
public class ProQuestionAdapter extends BaseAdapter{
    private Context context;
    private List<GetQuestion> getQuestionList;

    public ProQuestionAdapter(Context context, List<GetQuestion> getQuestionList) {
        this.context = context;
        this.getQuestionList = getQuestionList;
    }

    @Override
    public int getCount() {
        return getQuestionList.size();
    }

    @Override
    public Object getItem(int position) {
        return getQuestionList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }
    private class ViewHolder{
        private TextView question;//密保问题
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if(convertView==null){
            viewHolder=new ViewHolder();
            convertView= LayoutInflater.from(context).inflate(R.layout.my_question_list,null);
            viewHolder.question=(TextView)convertView.findViewById(R.id.question);
            convertView.setTag(viewHolder);

        }else {
            viewHolder=(ViewHolder)convertView.getTag();
        }
        viewHolder.question.setText(getQuestionList.get(position).getMbwt());
        return convertView;
    }
}
